<!--{template lyear:header_simple_start}-->
<!--{template lyear:header_simple_end}-->
<main class="bs-main-container">
	<div class="container-fluid">
		<!--{template lyear:right_header}-->
    <div class="card">
      <div class="card-body">
          <form id="cpform" action="{MOD_URL}&op=movetool" class="form-horizontal"  method="post" name="cpform" onsubmit="return validate(this);">
            <input type="hidden" value="{FORMHASH}" name="formhash">
            <input type="hidden" value="movesubmit" name="true">
            <div class="row mb-3">
              <label class="col-sm-2">{lang target_location}</label>
              <div class="col-sm-10">
                <select name="remoteid" class="form-select">
                  <!--{loop $spaces $value}--> 
                  <option value="$value[remoteid]" <!--{if $router[remoteid]==$value[remoteid]}-->selected="selected" 
                  <!--{/if}-->>$value[name]($value[fusesize] / $value[ftotalsize])
                  </option>
                  <!--{/loop}-->
                </select>
                <ul class="form-text">
                  <li>{lang cloud_movetool_designator_text}</li>
                </ul>
              </div>
            </div>
            <div class="row mb-3">
              <label class="col-sm-2">{lang original_location}</label>
              <div class="col-sm-10">
                <select name="oremoteid" class="form-select">
                  <!--{loop $spaces $value}-->
                  <option value="$value[remoteid]" >$value[name]($value[fusesize] / $value[ftotalsize])</option>
                  <!--{/loop}-->
                </select>
                <ul class="form-text">
                  <li>{lang cloud_movetool_designator_text}</li>
                </ul>
              </div>
            </div>
              <a href="javascript:;" onclick="jQuery('#filter').toggle(); document.getElementById('filter_guide').className=(document.getElementById('filter_guide').className=='mdi mdi-menu-down'?'mdi mdi-menu-up':'mdi mdi-menu-down');" class="btn btn-primary m-2">{lang filtrate_condition}&nbsp;<i id="filter_guide"  class="mdi mdi-menu-down"></i></a>
            <div id="filter" style="display:none;padding-left:50px;">
              <div class="row mb-3">
                <label class="col-sm-2">{lang file_type}</label>
                <div class="col-sm-10">
                  <textarea type="textarea" id="exts" class="form-control" name="router[exts]" row="6" cols="6"></textarea>
                  <div class="m-2 p-1">
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('jpg,jpeg,png,gif')">{lang photograph_class}</a>
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('doc,docx,rtf,odt,htm,html,txt')">word{lang type_attach}</a>
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('xls,xlsx,ods,sxc,csv,tsv')">excel{lang type_attach}</a>
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('ppt,pptx,pps,ppsx,odp,sxi')">ppt{lang type_attach}</a>
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('mp4,avi,wmv,mkv,rmvb,rm,asf,mpg,mpeg,mov')">{lang video_typename_attach}</a> 
                    <a href="javascript:;" class="btn btn-primary" onclick="setExts('txt,ini,conf,log,bat,sql,js,css,htm,html,xml,asp,aspx,php,jsp,json,py,h,c')">{lang text_class}</a>
                  </div>
                  <ul class="form-text">
                    {lang cloud_movetool_file_type_text}
                  </ul>
                </div>
              </div>
              <div class="row mb-3">
                <label class="col-sm-2">{lang file_size}</label>
                <div class="col-sm-10">
                  <div class="input-group mb-3">
                      <input type="text" class="form-control" placeholder="{lang typename_attach_gt}" name="router[size][lt]" value="">
                      <div class="input-group-text">M</div>
                      <input type="text" class="form-control" placeholder="{lang typename_attach_lt}" name="router[size][gt]" value="">
                      <div class="input-group-text">M</div>
                  </div>
                  <ul class="form-text">
                    {lang cloud_movetool_file_size_text}
                  </ul>
                </div>
              </div>
            </div>
            <dl class="mb-3 d-grid">
                <input class="btn btn-primary btn-round bodyloading" name="movesubmit" value="{lang starting_migration}" type="submit">
            </dl> 
          </form>
          <div class="alert alert-warning alert-dismissible fade show" role="alert">
            <strong>{lang board_message}</strong> {lang cloud_movetool_board_message_text}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
          </div>
      </div>
    </div>
    </div>
</main>
<script type="text/javascript">
 var  spaces=$spaces_json;
	function validate(form) {
		//验证原和目标位置
		if(form.remoteid.value == form.oremoteid.value) {
      showDialog('目标存储位置不能和原存储位置相同');
		form.remoteid.focus();
		return false; 
	 }
	 //判断原位置有无数据
	 if(spaces[form.oremoteid.value].usesize<1){
			alert('{lang cloud_movetool_home_position}');
		form.oremoteid.focus();
		return false; 
	 }
	 return true;
 }

 function setExts(str){
	  var old=trim(document.getElementById('exts').value).replace(/，{1,}/g,',').replace(/,{1,}/g,',').replace(/^\,/g,'');
	  var arr=old?old.split(','):[]; 
	  var newarr=str.split(',');
	  for(var i=0;i<newarr.length;i++){
		  if(jQuery.inArray(newarr[i],arr)<0){
			  arr.push(newarr[i]);
		  }
	  } 
	  document.getElementById('exts').value=arr.join(',');
  }
</script>
<!--{template lyear:footer_simple}--> 
